/*
 * GPS Simulator
 * Copyright (C) 2010, Brian E. Schmidt
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU gv; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 *   Author: Schmidt Brian E.           Programmer
 *   Email: brians444@hotmail.com
 */

#ifndef coordenadasH
#define coordenadasH

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <qmessagebox.h>


const float radioLAT = 40076.0;
const float radioLON = 40007.0;
const float eqsegLAT = radioLAT*1000.0/360.0/60.0/60.0;
const float eqsegLON = radioLON*1000.0/360.0/60.0/60.0;
const float segundo = 30;
const float tiempoActualizacion = 5;

struct terna{
	float grados;
	float minutos;
	float segundos;
	float metro;
};

struct VectorMetro{
    double lat;
    double lon;
};

class coordenadas
{
        public:
        float distRecorridTot, distRecorrid, distRestante, TiempitoArribo, VelocidadResultante, TiempitoArriboProm;
        bool ingreso_inicio;
        float VelocidadActual, VelocidadPromedioTotal,VelocidadPromedioActual, tiempoDeRecorrido;
        void ingresarLAT(struct terna);
        void ingresarLON(struct terna);
        void mostrarLAT();
        void mostrarLON();
        void CalcularDists(int, struct terna *);
        void CrearVistaMap();
        void CalcularHoraArribo(float );
        double DistanciaRestante(struct VectorMetro actual, struct VectorMetro anterior);
        void SeleccionarDestino(struct terna lati1, struct terna longi1);
        void CalcularDistanciaRestante();
        void CalcularVelocidadParaArribo(float );
        void CargarSiguienteMov(struct terna, struct terna);
        void mostrarDatos();
        coordenadas();
        ~coordenadas();

        private:
        struct terna latitud;
        struct terna longitud;
        struct VectorMetro puntoInicial, puntoAnterior, puntoActual;
        struct VectorMetro puntoFinal;
        void ingresar(struct terna *);
        void mostrar(struct terna );
};


#endif
